package com.ct.gd.passport.common.mock;

import android.os.AsyncTask;

public class ConnectAsyncTask extends AsyncTask<ConnectRequest, Integer, String> {

	IConnectable mConner;
	
	public ConnectAsyncTask(IConnectable conner) {
		super();
		mConner = conner;
	}
	
	@Override
	protected String doInBackground(ConnectRequest... args) {
		ConnectRequest cr = args[0];
		String response ="";
		try {
			response = HttpConnectClient.connect(cr);
		} catch (Exception e) {
			response = e.getMessage();
		}
		return response;
	}
	
	@Override
	protected void onPostExecute(String result) {
		mConner.onConnectComplete(result);
		super.onPostExecute(result);
	}
	
}
